// 引入http
import { http } from "../../utils/http";

Page({
  data: {
    //商品列表
    list: [],
  },
  async onLoad() {
    //发送网络请求
    let { data: res } = await http({
      url: "https://api.aslegou.top/api/getgoodlist",
      method: "GET",
      data: {
        cateid: 3,
        type: 1,
        page: 1,
        size: 20,
      },
      header: {},
    }).catch((err) => err);

    //处理图片的地址
    let list = res.list.goodData;

    list.forEach((item) => {
      item.img = "https://api.aslegou.top" + item.img;
    });
    //渲染到页面
    this.setData({
      list,
    });
  },
});
